﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using Marx.Utils;

namespace Marx
{
    [Serializable]
    public class ConfigDB
    {
        [XmlAttribute("delay_time")]
        public int DelayTime;
    }

    [Serializable]
    public class ConfigPlayer
    {
        [XmlAttribute("offline_protect_time")]
        public int OfflineProtectTime;
    }

    [Serializable]
    public class ConfigService
    {
        [XmlAttribute("name")]
        public string Name;

        [XmlAttribute("id")]
        public int Id;

        [XmlAttribute("index")]
        public int Index;

        [XmlAttribute("type")]
        public string Type;

        public int GetID(int zone)
        {
            return Id * 100 + zone;
        }
    }

    [Serializable]
    public class ConfigServices
    {
        [XmlElement("Service")]
        public List<ConfigService> Items;
    }

    [Serializable]
    [XmlRoot("Server")]
    public class ServerConfigData
    {
        [XmlElement("DB")]
        public ConfigDB DB;

        [XmlElement("Player")]
        public ConfigPlayer Player;

        [XmlElement("Services")]
        public ConfigServices Services;
    }
}
